package org.gienah.testing.xml;

import java.util.List;
import java.util.Map;

/**
 * @author Santiago L. Valdarrama
 * @since E0.2
 */
public class DependentDefinition {

	private final Map<String, DependencyDefinition> dependencies;
	private final List<String> contextFields;

	public DependentDefinition(final Map<String, DependencyDefinition> dependencies, final List<String> contextFields) {
		this.dependencies = dependencies;
		this.contextFields = contextFields;
	}

	public DependencyDefinition getDependency(final String property) {
		return this.dependencies != null
				? this.dependencies.get(property)
				: null;
	}

	public boolean isContextField(final String field) {
		return this.contextFields != null && this.contextFields.contains(field);
	}

}
